package com.lin.cloud.disk.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.cloud.disk.entity.pojo.User;
import com.lin.cloud.disk.entity.request.CountTotalSizeRequest;
import com.lin.cloud.disk.entity.request.GetUserInfoListRequest;
import com.lin.cloud.disk.entity.request.LoginRequest;
import com.lin.cloud.disk.entity.response.UserInfoResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (User)表数据库访问层
 *
 * @author ljc
 * @since 2020-12-10 16:48:58
 */
@Repository
public interface UserMapper extends BaseMapper<User> {

    /**
     * 通过账号密码获取用户信息
     * @param loginRequest
     * @return
     */
    User selectUserByUserNameAndPassword(LoginRequest loginRequest);


    /**
     * 通过用户Id列表 获取用户信息
     * @param userIdList
     * @return
     */
    List<UserInfoResponse> getDepartmentUserInfoByUserIdList(@Param("userIdList") List<Long> userIdList);

    /**
     * 查询userIdList中的数据
     * @param userIdList
     * @param companyId
     * @return
     */
    List<UserInfoResponse> getDepartmentUserInfoUserIdList(@Param("userIdList") List<Long> userIdList, @Param("companyId")  Long companyId);

    /**
     * 统计用户数量
     * @param request
     * @return
     */
    Integer countUserSize(CountTotalSizeRequest request);

    /**
     * 获取用户详情列表
     * @param request
     * @return
     */
    List<UserInfoResponse> getUserInfoList(GetUserInfoListRequest request);

    /**
     * 通过ID删除用户信息
     * @param idList
     * @param companyId
     */
    void deleteByIdList(@Param("userIdList") List<Long> idList, @Param("companyId")   Long companyId);

    /**
     * 通过用户名获取用户ID
     * @param userName
     * @return
     */
    Long getUserIdByUserName(String userName);

    /**
     * 获取公司内所有的用户ID
     * @param companyId
     * @return
     */
    List<Long> findUserIdListByCompanyId(Long companyId);

}